package day11.handler.simpleChannelHandler.response;

import day11.packet.response.MessageResponsePacket;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author chenshijie
 * @date 2023/12/26 13:39
 */

public class MessageResponseHandler extends SimpleChannelInboundHandler<MessageResponsePacket> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, MessageResponsePacket messageResponsePacket) throws Exception {

        System.out.println("收到了一条消息");
        int fromUserId = messageResponsePacket.getFromUserId();
        String fromUserName = messageResponsePacket.getUserName();
        System.out.println("用户id【" + fromUserId + "】, 用户名【" + fromUserName + "】 : " + messageResponsePacket.getMessage());


    }
}
